<template>
  <div class="main-container">
    <!-- 导航栏 -->
    <div class="nav-container">
      <el-menu :default-active="activeIndex" class="nav-menu" mode="horizontal" background-color="#e74413"
        text-color="#fff" active-text-color="#ffd04b">
        <div class="menu-wrapper">
          <el-menu-item>
            <a href="/home" target="_blank">综述</a>
          </el-menu-item>
          <el-menu-item>
            <a href="/GreatReselution" target="_blank">大革命</a>
          </el-menu-item>
          <el-menu-item>
            <a href="/home1" target="_blank">土地革命</a>
          </el-menu-item>
          <el-menu-item>
            <a href="/home3" target="_blank">抗日战争</a>
          </el-menu-item>
          <el-menu-item>
            <a href="/home4" target="_blank">解放战争</a>
          </el-menu-item>
          <el-menu-item>
            <a href="/home2" target="_blank">新中国成立</a>
          </el-menu-item>
        </div>
      </el-menu>
    </div>

    <!-- 轮播图 -->
    <el-carousel height="500px"> <!-- 调整高度 -->
      <el-carousel-item v-for="(item, index) in carouselItems" :key="index">
        <router-link :to="item.link">
          <div class="carousel-content">
            <h2>{{ item.title }}</h2> <!-- 移到图片上方 -->
            <img :src="item.imgUrl" :alt="item.title">
          </div>
        </router-link>
      </el-carousel-item>
    </el-carousel>
    <div class="ft">
      <footer>
        <p>版权所有 © 2024 Web前端开发设计11小组
        </p>
        <p>联系邮箱：contact@1234567890.cn</p>
      </footer>
    </div>
  </div>
</template>

<script setup>
const carouselItems = [
  {
    title: '综述',
    link: '/home',
    imgUrl: 'public/images/5001.jpg'  // 请替换为实际的图片URL
  },
  {
    title: '大革命',
    link: '/GreatReselution',
    imgUrl: 'public/images/5002.png'  // 请替换为实际的图片URL
  },
  {
    title: '土地革命',
    link: '/home1',
    imgUrl: 'public/images/5003.png'  // 请替换为实际的图片URL
  },
  {
    title: '抗日战争',
    link: '/home3',
    imgUrl: 'public/images/5004.png'  // 请替换为实际的图片URL
  },
  {
    title: '解放战争',
    link: '/home4',
    imgUrl: 'public/images/5005.png'  // 请替换为实际的图片URL
  },
  {
    title: '新中国成立',
    link: '/home2',
    imgUrl: 'public/images/5011.png'  // 请替换为实际的图片URL
  }
]
</script>

<style scoped>
.html {
  height: 100%;
}

.menu-wrapper {
  display: flex;
  justify-content: center;
  padding: 0px;
}

:deep(.el-menu) {
  display: flex;
  justify-content: center;
  border-bottom: none;
  margin-bottom: 20px;
  padding:0px;
}

:deep(.el-menu-item) {
  width: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0px;
  margin: 0px;
}

:deep(.el-menu-item a) {}

a {
  color: inherit;
  /* 继承父元素的文字颜色 */
  text-decoration: none;
  /* 取消下划线 */
  background: none;
  /* 取消背景 */
}

a:visited {
  color: inherit;
  /* 继承父元素的颜色，或者你可以设置为任意你希望的颜色 */
  text-decoration: none;
  /* 取消下划线 */

}

.main-container {
  min-height: 100vh;
  background-image: url('/public/260.jpg');
  /* 替换为你的背景图片路径 */
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  padding: 0px;
}


/* 轮播图内容样式调整 */
.carousel-content {
  height: 100%;
  width: 60%;
  /* 调整内容区域宽度 */
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  /* 标题和图片之间的间距 */
}

.carousel-content img {
  width: 100%;
  height: 400px;
  /* 固定图片高度 */
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.carousel-content h2 {
  position: static;
  /* 取消绝对定位 */
  margin: 0;
  padding: 15px 30px;
  font-size: 40px;
  border-radius: 8px;
  text-align: center;
}

/* 轮播图指示器样式 */
:deep(.el-carousel__indicators) {
  bottom: 20px;
}

:deep(.el-carousel__button) {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.7);
}

:deep(.el-carousel__indicator.is-active .el-carousel__button) {
  background-color: #fff;
}


:deep(.el-menu-item a) {
  text-decoration: none;
  color: inherit;
  font-size: 16px;
}

.ft footer {
  background-color: #920101;
  color: #fff;
  text-align: center;
  padding: 20px;
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 30px;
}

.ft footer p {
  margin: 0;
  padding:  0;
}

/* 响应式调整 */
@media (max-width: 1200px) {
  .carousel-content {
    width: 80%;
  }
}

@media (max-width: 768px) {
  .carousel-content {
    width: 90%;
  }

  .carousel-content h2 {
    font-size: 24px;
  }
}
</style>